package 设计模式.Singleton;

/**
 * 双锁检查 懒汉式单例模式
 *
 * */
public class DLC {

    private static volatile DLC dlC;
    private DLC() {
    }
    public static DLC getInstance() {
        if(dlC == null){
            synchronized (DLC.class){
                if (dlC==null){
                    dlC = new DLC();
                }
            }
        }
        return dlC;
    }

    public static void main(String[] args) {
        DLC instance = DLC.getInstance();
        DLC instance1 = DLC.getInstance();
        System.out.println(instance1==instance);
    }
}
